package com.dy.cloud.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

/**
 * @ClassName:
 * @Author: 仄言in
 * @Desctiption: (描述)
 * @Date: 2021/10/5 13:59
 * @Version 1.0 (版本)
 */
@RestController
@Slf4j
public class OrderController {
    @Value("${service-url.nacos-user-service}")
    private String paymentUrl;
    @Value("${server.port}")
    private String serverport;
    @Autowired
    private RestTemplate restTemplate;

    @GetMapping("/getPayment")
    public String getPayment() {
        String payments = restTemplate.getForObject(paymentUrl + "/getport", String.class);
        return "消费者端口号： "+serverport+" 服务提供者"+payments;
    }
}
